package com.lei.wiki.controller;

import com.lei.wiki.req.EbookQueryReq;
import com.lei.wiki.resp.CommonResp;
import com.lei.wiki.resp.EbookQueryResp;
import com.lei.wiki.service.EbookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Lei Tao
 */
@RestController
@RequestMapping("/ebook")
public class EbookController {

    private final EbookService ebookService;

    public EbookController(EbookService ebookService) {
        this.ebookService = ebookService;
    }

    @GetMapping("/list")
    public CommonResp<List<EbookQueryResp>> list(EbookQueryReq req) {
        return CommonResp.success(ebookService.list(req));
    }
}
